//购物车仓库
import {reqCartList} from "@/api"

const actions = {
    async getCartList({commit}) {
        let result = await reqCartList();
        // console.log(result.data)
        if(result.code==200){
            commit("GETCARTLIST",result.data)
        }
    },

    // async AddOrupdateShopCart({commit},){}
}


const mutations = {
    GETCARTLIST(state,cartlist){
        state.cartlist=cartlist
    }
}



const state = {
    cartlist: []
}



const getters = {
    getCartlist(state){
        return state.cartlist[0] || {};
    },
    // getCartInforlist(state){
    //     return state
    // }
}

export default {
    actions,
    mutations,
    state,
    getters
}
 